package edu.krazy.client;

import java.util.HashMap;

import edu.krazy.common.PositionInfo;


public class KrazyModel {
	private HashMap<String, PositionInfo> positions;
	
	
	
	public HashMap<String, PositionInfo> getPositions() {
		return positions;
	}



	public void setPositions(HashMap<String, PositionInfo> positions) {
		this.positions = positions;
	}



	public KrazyModel(String[] users){
		positions = new HashMap<String, PositionInfo>();
		for (int i = 0; i < users.length; i++) {
			positions.put(users[i], new PositionInfo(new float[]{0f,0f, 0f}, 0f, new float[]{0f, 0f, 0f}));
		}
	}
	
	public void updateClientPosition(String clientName, PositionInfo newInfo){
		synchronized (positions) {
			//System.out.println(clientName+" - "+newInfo.getPosition()[0]+"-"+newInfo.getPosition()[1]+"-"+newInfo.getPosition()[2]);
			if(positions.containsKey(clientName)){
				positions.put(clientName,  newInfo);
			}
		}		
	}
}
